package com.lxd.milktea.dataobject;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * @ProjectName: milktea
 * @Package: com.lxd.milktea.dataobject
 * @ClassName: StockInfo
 * @Author: carrymaniac
 * @Description: 库存变化信息，包括进货和每日结账
 * @Date: 2020/5/3 10:14 上午
 * @Version:
 */
@Entity
@Table(name = "tb_stock_info", schema = "milk", catalog = "")
public class StockInfo {
    private String id;
    private String materialId;
    private Timestamp settleDate;
    private byte type;
    private int num;
    private int nowStock;

    @Id
    @Column(name = "id")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "material_id")
    public String getMaterialId() {
        return materialId;
    }

    public void setMaterialId(String materialId) {
        this.materialId = materialId;
    }

    @Basic
    @Column(name = "SettleDate")
    public Timestamp getSettleDate() {
        return settleDate;
    }

    public void setSettleDate(Timestamp settleDate) {
        this.settleDate = settleDate;
    }

    @Basic
    @Column(name = "type")
    public byte getType() {
        return type;
    }

    public void setType(byte type) {
        this.type = type;
    }

    @Basic
    @Column(name = "num")
    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    @Basic
    @Column(name = "now_stock")
    public int getNowStock() {
        return nowStock;
    }

    public void setNowStock(int nowStock) {
        this.nowStock = nowStock;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        StockInfo stockInfo = (StockInfo) o;

        if (type != stockInfo.type) return false;
        if (num != stockInfo.num) return false;
        if (nowStock != stockInfo.nowStock) return false;
        if (id != null ? !id.equals(stockInfo.id) : stockInfo.id != null) return false;
        if (materialId != null ? !materialId.equals(stockInfo.materialId) : stockInfo.materialId != null) return false;
        if (settleDate != null ? !settleDate.equals(stockInfo.settleDate) : stockInfo.settleDate != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (materialId != null ? materialId.hashCode() : 0);
        result = 31 * result + (settleDate != null ? settleDate.hashCode() : 0);
        result = 31 * result + (int) type;
        result = 31 * result + num;
        result = 31 * result + nowStock;
        return result;
    }
}
